import request from '@/utils/request'

/**
 * @description 列表
 * @param data
 * @returns
 */
export const getUserLabelListApi: IGetUserLabelListApi = function (params) {
  return request.get('htscrm/work/tags', { params });
};

/**
 * @description 用户标签关系同步
 * @param data
 * @returns
 */
export const getTagsUserApi: IGetUserLabelListApi = function (params) {
  return request.post('htscrm/work/tags_user/sync', { params });
};

/**
 * @description 详情
 * @param data
 * @returns
 */
export const getUserLabelDetailApi: IGetUserLabelDetailApi = function (id) {
  return request.get(`htscrm/users/info/${id}`);
};

/**
 * @description 添加
 * @param data
 * @returns
 */
export const addUserLabelApi: IAddUserLabelApi = function (data) {
  return request.post('htscrm/users/add', data);
};

/**
 * @description 编辑
 * @param data
 * @returns
 */
export const updateUserLabelApi: IUpdateUserLabelApi = function (data) {
  return request.post(`htscrm/users/edit/${data.id}`, data);
};

/**
 * @description 删除
 * @param data
 * @returns
 */
export const deleteUserLabelApi: IDeleteUserLabelApi = function (id) {
  return request.post(`htscrm/users/del/${id}`);
};

/**
 * 批量删除
 * @param ids
 * @returns
 */
export const batchDeleteUserLabelApi: IBatchDeleteUserLabelApi = function(ids) {
  return request.post(`htscrm/activity/delete`, {ids})
}

/**
 * 同步标签分组
 * @param ids
 * @returns
 */
export const syncLabelGroupApi = function() {
  return request.post(`htscrm/work/tags/sync`)
}